import convert_candidate_file
import pipeline
from easy_io import H5Writer
from prepare_h5_file_with_interpolation_with_multiple_h5 import gen


convert_candidate_file.main(
    infile='../../data/faster_rcnn_candidates/candis_v9_5fold.pkl',
    outfile='../../data/tmp_fp_reduction/lidc_kaggle_candidates_v8.pkl'
)
convert_candidate_file.main(
    infile='../../data/faster_rcnn_candidates/candis_v9_kaggle_beni.pkl',
    outfile='../../data/tmp_fp_reduction/kaggle_beni_candidates_v3.pkl'
)
convert_candidate_file.main(
    infile='../../data/faster_rcnn_candidates/candis_v9_kaggle_testset.pkl',
    outfile='../../data/tmp_fp_reduction/kaggle_testset_candidates_v3.pkl'
)
convert_candidate_file.main(
    infile='../../data/faster_rcnn_candidates/candis_v9_spie.pkl',
    outfile='../../data/tmp_fp_reduction/spie_candidates_v3.pkl'
)

pipeline.main(
    infile='../../data/tmp_fp_reduction/lidc_kaggle_candidates_v8.pkl',
    outfile='../../data/tmp_fp_reduction/lidc_kaggle_candidates_v9.pkl',
    division_file='lidc_kaggle_divisions.pkl',
    pos_label_dict_file='lidc_kaggle_label_dict_3_backup.pkl',
    mid_label_dict_file='lidc_kaggle_label_dict_1_backup.pkl',
)
pipeline.main(
    infile='../../data/tmp_fp_reduction/kaggle_beni_candidates_v3.pkl',
    outfile='../../data/tmp_fp_reduction/kaggle_beni_candidates_v4.pkl',
    start=90000,
)
pipeline.main(
    infile='../../data/tmp_fp_reduction/kaggle_testset_candidates_v3.pkl',
    outfile='../../data/tmp_fp_reduction/kaggle_testset_candidates_v4.pkl',
    start=60000,
)
pipeline.main(
    infile='../../data/tmp_fp_reduction/spie_candidates_v3.pkl',
    outfile='../../data/tmp_fp_reduction/spie_candidates_v4.pkl',
    start=30000,
)

H5Writer(
    '../../data/tmp_fp_reduction/lidc_kaggle_candidates_v9.hdf5',
    'w',
    gen(
        candidate_pkl_file='../../data/tmp_fp_reduction/lidc_kaggle_candidates_v9.pkl',
        data_h5_files={
            'lidc': '../../data/lidc/vol.hdf5',
            'kaggle_mali': '../../data/kaggle/vol.hdf5'
        },
        min_edge_length=68,
    )
)
H5Writer(
    '../../data/tmp_fp_reduction/lidc_kaggle_candidates_v9.hdf5',
    'a',
    gen(
        candidate_pkl_file='../../data/tmp_fp_reduction/spie_candidates_v4.pkl',
        data_h5_files={
            'spie': '../../data/spie/vol.hdf5',
        },
        min_edge_length=68,
    )
)
H5Writer(
    '../../data/tmp_fp_reduction/lidc_kaggle_candidates_v9.hdf5',
    'a',
    gen(
        candidate_pkl_file='../../data/tmp_fp_reduction/kaggle_testset_candidates_v4.pkl',
        data_h5_files={
            'kaggle_testset': '../../data/kaggle/vol.hdf5',
        },
        min_edge_length=68,
    )
)
H5Writer(
    '../../data/tmp_fp_reduction/lidc_kaggle_candidates_v9.hdf5',
    'a',
    gen(
        candidate_pkl_file='../../data/tmp_fp_reduction/kaggle_beni_candidates_v4.pkl',
        data_h5_files={
            'kaggle_beni': '../../data/kaggle/vol.hdf5',
        },
        min_edge_length=68,
    )
)

convert_candidate_file.main(
    infile='../../data/faster_rcnn_candidates/candis_v15_5fold.pkl',
    outfile='../../data/tmp_fp_reduction/lidc_kaggle_candidates_v14.pkl'
)
convert_candidate_file.main(
    infile='../../data/faster_rcnn_candidates/candis_v15_kaggle_beni.pkl',
    outfile='../../data/tmp_fp_reduction/kaggle_beni_candidates_v9.pkl'
)
convert_candidate_file.main(
    infile='../../data/faster_rcnn_candidates/candis_v15_kaggle_testset.pkl',
    outfile='../../data/tmp_fp_reduction/kaggle_testset_candidates_v9.pkl'
)
convert_candidate_file.main(
    infile='../../data/faster_rcnn_candidates/candis_v15_spie.pkl',
    outfile='../../data/tmp_fp_reduction/spie_candidates_v9.pkl'
)

pipeline.main(
    infile='../../data/tmp_fp_reduction/lidc_kaggle_candidates_v14.pkl',
    outfile='../../data/tmp_fp_reduction/lidc_kaggle_candidates_v15.pkl',
    apply_merge=False,
    division_file='lidc_kaggle_divisions_4fold.pkl',
    pos_labelinfo_file='lidc_kaggle_labelinfo_3.pkl',
    mid_labelinfo_file='lidc_kaggle_labelinfo_1.pkl',
)
pipeline.main(
    infile='../../data/tmp_fp_reduction/spie_candidates_v9.pkl',
    outfile='../../data/tmp_fp_reduction/spie_candidates_v10.pkl',
    apply_merge=False,
    start=300000,
    pos_labelinfo_file='spie_labelinfo.pkl'
)
pipeline.main(
    infile='../../data/tmp_fp_reduction/kaggle_testset_candidates_v9.pkl',
    outfile='../../data/tmp_fp_reduction/kaggle_testset_candidates_v10.pkl',
    apply_merge=False,
    start=200000,
    pos_labelinfo_file='lidc_kaggle_labelinfo_3.pkl',
)
pipeline.main(
    infile='../../data/tmp_fp_reduction/kaggle_beni_candidates_v9.pkl',
    outfile='../../data/tmp_fp_reduction/kaggle_beni_candidates_v10.pkl',
    apply_merge=False,
    start=100000,
)

H5Writer(
    '../../data/tmp_fp_reduction/lidc_kaggle_candidates_v15.hdf5',
    'w',
    gen(
        candidate_pkl_file='../../data/tmp_fp_reduction/lidc_kaggle_candidates_v15.pkl',
        data_h5_files={
            'lidc': '../../data/lidc/vol.hdf5',
            'kaggle_mali': '../../data/kaggle/vol.hdf5'
        },
        min_edge_length=68,
    )
)

H5Writer(
    '../../data/tmp_fp_reduction/lidc_kaggle_candidates_v15.hdf5',
    'a',
    gen(
        candidate_pkl_file='../../data/tmp_fp_reduction/kaggle_beni_candidates_v10.pkl',
        data_h5_files={
            'kaggle_beni': '../../data/kaggle/vol.hdf5',
        },
        min_edge_length=68,
    )
)

H5Writer(
    '../../data/tmp_fp_reduction/lidc_kaggle_candidates_v15.hdf5',
    'a',
    gen(
        candidate_pkl_file='../../data/tmp_fp_reduction/kaggle_testset_candidates_v10.pkl',
        data_h5_files={
            'kaggle_testset': '../../data/kaggle/vol.hdf5',
        },
        min_edge_length=68,
    )
)

H5Writer(
    '../../data/tmp_fp_reduction/lidc_kaggle_candidates_v15.hdf5',
    'a',
    gen(
        candidate_pkl_file='../../data/tmp_fp_reduction/spie_candidates_v10.pkl',
        data_h5_files={
            'spie': '../../data/spie/vol.hdf5',
        },
        min_edge_length=68,
    )
)
